package com.g4.shoppingsingle.controller;


import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 处理所有页面的跳转
 */
@Api(tags = "页面跳转")
@Controller
@Slf4j
@RequestMapping("/")
public class MainController {

    /**
     * 自动跳转首页页面
     * @return
     */
    @GetMapping
    @ApiOperation("自动跳转首页页面")
    public String index(){
        return "index";
    }

    /**
     * 处理页面间的跳转
     * @param target
     * @return
     */
    @GetMapping("views/{target}")
    @ApiOperation("处理页面间的跳转")
    public String toView(@PathVariable String target){
        //跳转视图
        return target;   // register  跳  /templates/register.html
    }





}
